
//
//  NetWorkManager.m
//  Nidalee
//
//  Created by bug neo on 05/12/2020.
//  Copyright © 2020 李康. All rights reserved.
//

#import "NetWorkManager.h"

@implementation NetWorkManager
- (void)Post_url:(NSString *)url params:(NSDictionary *)params success:(void (^)(id _Nonnull))success fauilre:(void (^)(NSString * _Nonnull))fauilre {
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", @"text/plain", nil];

    [manager POST:url parameters:params headers:nil progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSLog(@"responseObject = %@",responseObject);

        if (success) {
            success(responseObject);
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"error = %@",error);
        if (fauilre) {
            fauilre(@"失败");
        }
    }];
}
@end
